package com.aoyy.service;

import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.aoyy.model.BoardManager;
import com.aoyy.dao.BoardManagerDao;
/**===========================================================================================
 * Board manager service <code>BoardManagerSerice</code> is to appoint manager for board.
 * @author this author
 * @date 2017-08-12
 * =========================================================================================== */
@Service
public class BoardManagerService {
	@Autowired
	private BoardManagerDao boardManagerDao;
	
	public void setBoardManagerDao(BoardManagerDao boardManagerDao) {
		this.boardManagerDao = boardManagerDao;
	}
	
	public BoardManagerDao getBoardManagerDao() {
		return boardManagerDao;
	}
	
	// Save board manager
	public void save(BoardManager boardManager) {
		boardManagerDao.save(boardManager);
	}
	
	// Delete board manager by boardId & userId
	public void delete(Integer boardId, Integer userId) {
		boardManagerDao.delete(boardId, userId);
	}
	
	// Query board manager list by userId
	public List<BoardManager> queryBoardManagersByUserId(Integer userId) {
	    return boardManagerDao.queryBoardManagersByUserId(userId); 	
	}
	
	// Query board manager by boardId & userId
	public BoardManager queryBoardManagerByBoardIdAndUserId(Integer boardId, Integer userId) {
		return boardManagerDao.queryBoardManagerByBoardIdAndUserId(boardId, userId);
	}

}
